package org.dawning.fantasy.core.bean;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;

/**
 * 获得Bean对象
 * Created by dsp on 2016/10/24.
 */
@Component
public class AppBean implements ApplicationContextAware {

    private static ApplicationContext applicationContext;

    @Override
    public void setApplicationContext(ApplicationContext appCtx) throws BeansException {
        applicationContext=appCtx;
    }

    public static  Object getObject(String name) {
        return applicationContext.getBean(name);
    }


}
